<template>
    <div class="company-user">
        <index-breadcrumb :breadcrumb-list="breadcrumbList"></index-breadcrumb>
        <BusinessList :operation-list="operationList" :is-show="showStatus"></BusinessList>
    </div>
</template>

<script>
import BusinessList from "@/views/business/includes/Business";

export default {
    name: "Business",
    components: {
        BusinessList,
    },
    data() {
        return {
            operationList: [],
            breadcrumbList: [
                {
                    title: "商务管理"
                },
            ],
            showStatus: true,
        };
    },
    created() {
        this.getOperationList();
    },
    methods: {
        backShow() {
            this.showStatus = true
        },
        getOperationList() {
            this.$store.state.permissionList.forEach(item => {
                const [itemName] = item.permission.split(":");
                if (itemName === "business") {
                    this.operationList = item.list.map(listItem => {
                        return listItem.permission.split(":")[1];
                    });
                }
                if (itemName === "businessData") {
                    if(item.permission === "businessData:view"){
                        this.operationList.push("businessData:view");
                        return true;
                    }else{
                        return false;
                    }
                }
            });
        }
    },
    beforeRouteLeave(to, from, next) {
        this.$bus.$emit('clearSearchParams')
        next()
    },
};
</script>

<style lang="sass" scoped>

</style>
